<!DOCTYPE html>
<html>
<head>
   <title>CSS Animations - animation-fill-mode: both</title>
   <link rel="author" title="Opera Software ASA" href="http://www.opera.com/">
   <link rel="help" href="http://dev.w3.org/csswg/css3-animations/#the-animation-fill-mode-property-">
   <meta name="flags" content="dom">
   <meta name="assert" content="If the value for 'animation-fill-mode' is
   'both', then the animation will follow the rules for both 'forwards' and
   'backwards'">
   <script src="/resources/testharness.js"></script>
   <script src="/resources/testharnessreport.js"></script>
   <style type="text/css">
      @keyframes slide {
         from {
            margin-left: 110px;
         }
         to {
            margin-left: 210px;
         }
      }
      p + div {
         width: 100px;
         height: 100px;
         background: blue;
         animation-duration: 0.5s;
         animation-delay: 0.5s;
         animation-fill-mode: both;
      }
      div + div {
         margin-top: -105px;
         margin-left: 105px;
         border: 5px solid black;
         width: 200px;
         height: 100px;
      }
      .test {
         animation-name: slide;
      }
   </style>
   <script type="text/javascript">
      setup({explicit_done:true});
      onload = function() {
         var testName = document.querySelector('title').firstChild.data;
         var div = document.querySelector('div');
         var log = document.querySelectorAll('p')[1].firstChild;
         var style = getComputedStyle(div, null);
         var passed = false;
         setTimeout(function() {
            passed = (style.marginLeft == '110px');
         }, 250);
         setTimeout(function() {
            passed = (passed && style.marginLeft == '210px');
            test(function(){assert_true(passed);}, testName); done();
            log.data = (passed ? 'PASS if the animation occurred.' : 'FAIL');
         }, 1250);
         div.className = 'test';
      }
   </script>
   <style>iframe{display:none}</style>
</head>
<body>
   <p>The blue square below should pause while left-aligned inside the border,
   then slide rightwards, stopping at the right edge.</p>
   <p>Testing...</p>
   <div></div>
   <div></div>
</body>
</html>
